#include <iostream>
using namespace std;
const int N = 1010;
int a[N];
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int left = 0, right = 1;
    int count = 0, ans = 1;
    while(right < n) {
        if (a[right] - a[right - 1] == 1) {
            right++;
        }else {
            ans = max(ans, right - left);
            left = right++;
        }
    }
    ans = max(ans, right - left);
    cout << ans << endl;
    return 0;
}